<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>


    <div id="app">

        <my-component>
        </my-component>
    </div>

    <template id="myComponent">
        <div>
            <h2>{{ msg }}</h2>
            <button v-on:click="showMsg">Show Message</button>
        </div>
    </template>

    <script src="../plugins/vue/vue.min.js"></script>

    <script>
        new Vue({
            el: '#app',
            components: {
                'my-component': {
                    template: '#myComponent',
                    data: function() {
                        return {
                            msg: 'This is a component!'
                        }
                    },
                    methods: {
                        showMsg: function() {
                            alert(this.msg)
                        }
                    }
                }
            }
        })
    </script>

</body>

</html>